(function($) {
	// reinit layout
	var navi = $('#content').find('.navi')[0];
	var sidebar = $('#content #sidebar');
	var main = $('#inner-content');
	if(navi) {
		$(('#content')).prepend(navi);
	}
	if(sidebar) {
		sidebar.insertBefore('#inner-content');
	}
	// end reinit layout

    $('.user-cp').click(function() {
        if ($(this).find('.sub-user-cp').css('display') === 'none') {
            $(this).find('.sub-user-cp').css('display', 'block');
        }
    });

    var overflow_content = function() {
        $('#content #inner-content').css({
            height: function() {
                var header_height = $('#header').height(),
                        navi_height = $('#content .navi').height(),
                        window_height = $(window).height();

                return window_height - header_height - navi_height - 38;
            }
        });
    }
    $(window).resize(overflow_content);
    overflow_content();

    // uniform
    $("input[type=checkbox], input[type=radio]").uniform();
    
    //choosen
    $('select').chosen();
})(jQuery);